<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {
            name: "张三",
            aderr: "成都"
        }

        function fn(obj) {
            let index = 0;
            return {
                next: function () {
                    if (index < obj.length) {
                        return {
                            "val": obj[index++],
                            "done": false
                        }
                    } else {
                        return {
                            "val": undefined,
                            "done": true
                        }
                    }
                }
            }
        }

        let keys = Object.keys(obj)
        let iterfn = fn(keys)
        console.log(iterfn.next());
        
        for (o of keys) {
            console.log(o);
        }
    </script>
</body>

</html>